package com.sunriz.domain;

import org.springframework.http.HttpStatus;

import java.util.HashMap;

/**
 * @description:
 * @author: 童锣烧
 * @time: 2023/11/10
 */
public class AjaxResult extends HashMap<String,Object> {

    private static final long serialVersionUID = 1L;

    private static final String SUCCESS_TAG= "success";

    private static final String DATA_TAG="data";

    private static final String CODE_TAG="code";

    private static final String MSG_TAG="message";

    /**
     * 构造函数
     */
    public AjaxResult(){

    }


    /**
     * 构造函数
     * @param success
     * @param data
     * @param code
     * @param message
     */
    public AjaxResult(Boolean success,Object data,String code,String message){
        super.put(SUCCESS_TAG,success);
        super.put(DATA_TAG,data);
        super.put(CODE_TAG,code);
        super.put(MSG_TAG,message);
    }
    public static AjaxResult success(){
        return new AjaxResult(true,null,null,null);
    }

    public static AjaxResult success(Boolean success,Object data,String code,String message){
        return new AjaxResult(success,data,code,message);
    }

    public static AjaxResult error(Boolean success,Object data,String code,String message){
        return new AjaxResult(success,data,code,message);
    }
}
